home *** CD-ROM | disk | FTP | other *** search
/ BBS in a Box 4 / BBS in a Box - Macintosh - Volume IV (January 1992) (BBS in a Box).iso / Files / Prog / H-K / ICE.PAS < prev    next >
Encoding:
Pascal/Delphi Source File  |  1987-04-15  |  2.6 KB  |  113 lines  |  [TEXT/MACA]

  1. program Ice;
  2. { Sample security routine }
  3.  
  4. {$R Ice.Rsrc}
  5. {$U-}
  6. {$B+}
  7. {$T APPLCAPD}
  8.  
  9. uses Memtypes,QuickDraw,OSIntf,ToolIntf,PackIntf;
  10.  
  11. procedure Initialize; { Initialize everything }
  12. begin
  13.    InitGraf(@thePort);
  14.    InitFonts;
  15.    InitWindows;
  16.    InitMenus;
  17.    TEInit;
  18.    InitDialogs(NIL);
  19.    FlushEvents(everyEvent,0)
  20. end; { of Initialize }
  21.  
  22. procedure DoPet;
  23.  
  24. procedure DoScum;
  25.  
  26. const
  27.    theAlert       = 1002;
  28.  
  29. var
  30.    thebutton      : integer;
  31.  
  32. begin
  33.    thebutton := StopAlert(theAlert,NIL);
  34.    halt
  35. end;
  36.  
  37. const
  38.    DialogID       = 1003;
  39.    OKBtn          = 1;
  40.    petName        = 3;
  41.  
  42. var
  43.    theDialog            : DialogPtr;
  44.    itemHit,theType      : integer;
  45.    NameHandle           : handle;
  46.    theName              : Str255;
  47.    thebox               : rect;
  48.  
  49. begin
  50.    theDialog := GetNewDialog(DialogID,nil, pointer (-1));
  51.    SelIText(theDialog,petName,0,10);
  52.    GetDItem (theDialog, petName, theType, NameHandle, theBox);
  53.    ShowWindow(theDialog);
  54.    ModalDialog(Nil,itemHit);
  55.    GetIText(NameHandle,theName);
  56.    DisposDialog(theDialog);
  57.    UprString(theName,false);
  58.    if (theName <> 'FRED' ) then DoScum
  59. end; { of DoPet }
  60.  
  61. const
  62.    DialogID       = 1001;
  63.    OKBtn          = 1;
  64.    PamBtn         = 2;
  65.    Cliff_NBtn     = 3;
  66.    Cliff_GBtn     = 4;
  67.    ChrisBtn       = 5;
  68.    UserBtn        = 6;
  69.    btnOff         = 0;
  70.    btnOn          = 1;
  71.    WindowID       = 1001;
  72.    Welcome        = 'Welcome';
  73.  
  74. var
  75.    theDialog            : DialogPtr;
  76.    radHdl               : handle;
  77.    itemHit,theType,Item,
  78.    theName              : integer;
  79.    theBox               : rect;
  80.    Access               : boolean;
  81.    TheWindow            : WindowPtr;
  82.    clicked              : boolean;
  83.  
  84. begin
  85.    Initialize;
  86.    theDialog := GetNewDialog(DialogID,nil, pointer (-1));
  87.    GetDItem (theDialog, PamBtn, theType, radHdl, theBox);
  88.    SetCtlValue(ControlHandle(radHdl),btnOn);
  89.    InitCursor;
  90.    ShowWindow(theDialog);
  91.    repeat
  92.       ModalDialog(Nil,itemHit);
  93.       for item := PamBtn to UserBtn Do
  94.       begin
  95.          GetDItem (theDialog, item, theType, radHdl, theBox);
  96.          SetCtlValue(ControlHandle(radHdl),btnOff);
  97.       end;
  98.       GetDItem (theDialog, itemHit, theType, radHdl, theBox);
  99.       SetCtlValue(ControlHandle(radHdl),btnOn);
  100.       if ( itemHit <> OKBtn ) then theName := itemHit;
  101.    until( itemHit = OKBtn );
  102.    DisposDialog(theDialog);
  103.    if ( theName = UserBtn ) then Access := false else DoPet;
  104.    theWindow := GetNewWindow(WindowID,Nil,Pointer(-1));
  105.    SetPort(theWindow);
  106.    TextFont(London);
  107.    TextSize(18);
  108.    MoveTo(200,50);
  109.    DrawString(Welcome);
  110.    repeat
  111.       clicked := button
  112.    until clicked
  113. end. { of Ice }